package poly_.detail_;

public class PolyDetail03 {
    public static void main(String[] args) {
        BB bb = new BB();
        //instanceOf比较操作符，用于判断对象的类型是否为XX类型或XX类型的子类型
        System.out.println(bb instanceof BB); // true，bb是BB类型或BB类型的子类型
        System.out.println(bb instanceof AA); // true

        //aa 编译类型 AA，运行类型 BB
        AA aa = new BB();
        System.out.println(aa instanceof AA);
        System.out.println(aa instanceof BB);

        Object obj = new Object();
        System.out.println(obj instanceof AA); // false
        String str = "hello";
        System.out.println(str instanceof Object); // true
    }
}

class AA{}
class BB extends AA{}
